<%@ page import="br.edu.ufam.controleAcesso.Menu" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main"/>
        <g:javascript library="app/aplicacao"/>
    </head>
    <body>
        <h1>Alterar Aplicação</h1><hr/>
          <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
          </g:if>
          <g:hasErrors bean="${aplicacao}">
            <div class="errors">
                <g:renderErrors bean="${aplicacao}" as="list" />
            </div>
          </g:hasErrors>
          <div id="validateErrors"class="errors" style="display:none;">
            <ul></ul>
          </div>
          <br/>
          <g:form name="formAplicacao" controller="aplicacao" method="post" >
            <input type="hidden" name="id" value="${aplicacao?.id}" />
            <table  width="100%" border="0" cellspacing="5" cellpadding="0" align="center" class="textoverdana">
            <tr>
              <td width="300">Menu: *<br/>
                <g:select style="width:225px" 
                          optionKey="id" 
                          from="${Menu.listOrderByDescricao()}" 
                          id="menu.id" 
                          name="menu.id"                           
                          value="${aplicacao.menu?.id}" 
                          noSelection="['':'']" 
                          class="text ui-widget-content ui-corner-all"/>
              </td>
                <td>&nbsp;</td>
            </tr>
            <tr>
              <td>Descrição: *<br/>
                  <input type="text"
                         size="35" 
                         id="descricao" 
                         name="descricao" 
                         value="${fieldValue(bean:aplicacao,field:'descricao')}"
                         class="text ui-widget-content ui-corner-all"/>
              </td>
                <td>&nbsp;</td>
            </tr>
            <tr>
              <td>Controller: *<br/>
                  <input type="text" 
                         size="35" 
                         id="controle" 
                         name="controle" 
                         value="${fieldValue(bean:aplicacao,field:'controle')}"
                         class="text ui-widget-content ui-corner-all"/>
              </td>
                <td>&nbsp;</td>
            </tr>
            <tr>
              <td> <g:checkBox id="ativo" 
                               name="ativo" 
                               value="${true}" 
                               checked="${aplicacao?.ativo}"
                               class="text ui-widget-content ui-corner-all"/> Ativo *
              </td>
                <td>&nbsp;</td>
            </tr>
            <tr>
              <td> <g:checkBox id="visivel" 
                               name="visivel" 
                               value="${true}" 
                               checked="${aplicacao?.visivel}"
                               class="text ui-widget-content ui-corner-all"/> Visível *
              </td>
                <td>&nbsp;</td>
            </tr>
            <tr>
              <td>Data Início: *<br/>
                 <input id="dtinicio" 
                        maxlength="16" 
                        name="dtinicio" 
                        value="<g:formatDate format="dd/MM/yyyy HH:mm" date="${aplicacao?.dtinicio}"/>" 
                        class="text ui-widget-content ui-corner-all"/>
              </td>
                <td>&nbsp;</td>
            </tr>
            <tr>
              <td>Data Fim: *<br/>
                  <input id="dtfim" 
                         maxlength="16" 
                         name="dtfim" 
                         value="<g:formatDate format="dd/MM/yyyy HH:mm" date="${aplicacao?.dtfim}"/>" 
                         class="text ui-widget-content ui-corner-all"/>
              </td>
                <td>&nbsp;</td>
            </tr>
          </table>
              <p>
                <g:actionSubmit class="botao" id="atualizar" action="update" value="Atualizar" onClick="return validar();"/>
                <g:actionSubmit class="botao" id="deletar" action="delete" value="Apagar" onclick="return confirm('Deseja realmente apagar?');"/>
                <g:link action="list"><input class="botao" id="voltar" type="button" value="Voltar" /></g:link>
              </p>          
          <p align="left"><em>*Campos Obrigat&oacute;rios</em></p>
        </g:form>
    </body>
</html>
